object Practise1 {
  def averageBelowN(numbers: List[Int], n: Int): Double = {
    // 过滤出所有小于n的数
    val filteredNumbers = numbers.filter(_ < n)
    
    // 如果没有小于n的数，返回0.0
    if (filteredNumbers.isEmpty) 0.0
    else {
      // 计算平均值
      filteredNumbers.sum.toDouble / filteredNumbers.length
    }
  }

  def main(args: Array[String]): Unit = {
    val numbers = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    val n = 6
    val avg = averageBelowN(numbers, n)
    println(s"小于 $n 的数的平均值是: $avg")
  }
}